package com.yz.mcd.view.impl;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.yz.mcd.R;
import com.yz.mcd.view.BasePager;
import com.yz.mcd.view.dialog.ModeDialog;

/**
 *
 * 首页
 *
 * Created by Maverick on 2017/4/26.
 */

public class HomePager extends BasePager {

    public TextView tvSetting;
    public TextView tvAddMode;

    public HomePager(Activity activity) {
        super(activity);
    }

    @Override
    public void initData() {

        System.out.println("首页初始化");

        //要给帧布局填充一个布局对象
        View view = View.inflate(mActivity, R.layout.home_detail,null);

        tvSetting = (TextView) view.findViewById(R.id.tv_setting_mode);
        tvAddMode = (TextView) view.findViewById(R.id.tv_add_mode);

//        tvSetting.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
//        tvSetting.setText(Html.fromHtml("<u>使用html实现下划线样式</u>"));

        flContent.addView(view);


        //修改页面标题
        tvTitle.setText("云智联创");

        tvAddMode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showModeDialog();
            }
        });
    }

    /**
     * 弹出添加模式对话框
     *
     */
    private void showModeDialog() {
        ModeDialog modeDialog = new ModeDialog(mActivity);
        modeDialog.setCancelable(true);//设置dialog可以取消
        modeDialog.setCanceledOnTouchOutside(true);//设置点击外边可以自动消失
        modeDialog.show();
    }
}
